package com.lmk.t01;

public class ThreadTest {
    public static void main(String[] args) {
      /*  //1. 创建线程对象通过Thread子类实例化
        Thread t1=new myThread();
        //2.启动线程
        t1.start();
        //2.通过实现Runnable接口的类的对象 创建


       Thread t2=new Thread(()-> System.out.println("子线程二运行中..."));
       t2.start();*/
        Thread t1=new Thread(()->{

            for (int i = 0; i <10 ; i++) {
                System.out.println("线程1："+i);
            }
    }
                );
        Thread t2=new Thread(()->
        {
            for (int i = 0; i <10 ; i++) {
                System.out.println("线程2："+i);
            }
        }
        );

     t1.run();
     t2.run();
    }
    static  class  Task implements Runnable{
        @Override
        public void run() {
            System.out.println("子线程二在运行....");
        }
    }


   static  class myThread extends Thread
   {
       @Override
       public void run() {
           System.out.println("子线程运行中.....");
       }
   }}
